package com.lzx.applib.utils;

import java.io.UnsupportedEncodingException;

/**
 * Created by Lzx on 16/12/01 0001.
 */
public class StringUtil {
    public static final String TAG = "StringUtil";

    /**中文+1，英文+0.5*/
    public static int getLength(String data) {
        int length = data.length();
        try {
            length = data.toString().getBytes("GBK").length;
            return (length+1) / 2;
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return length;
    }
}
